package com.xunji.user.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xunji.user.vo.req.MenuAddRequest;
import lombok.Data;

@TableName(value = "t_lp_menu")
@Data
public class Menu {

    @TableId(value = "ID", type = IdType.AUTO)
    private Integer id;

    private String name;

    private String pinYin;

    private String uri;

    private Integer pId;

    private Integer weight;


    public static Menu getInstance(MenuAddRequest request){
        Menu menu = new Menu();
        menu.setName(request.getName());
        menu.setPinYin(request.getPinYin());
        menu.setUri(request.getUri());
        menu.setPId(request.getParentId());
        menu.setWeight(request.getWeight());
        return menu;
    }
}
